/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Base_InductionFurnace",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using Mercury.Entity.DomainModels;
using Mercury.Business.IServices;
using Mercury.Core.Utilities;
using Mercury.Business.IRepositories;
using System.Linq;

namespace Mercury.Business.Controllers
{
    public partial class Base_InductionFurnaceController
    {
        private readonly IBase_InductionFurnaceService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly IBase_InductionFurnaceRepository _repository;

        [ActivatorUtilitiesConstructor]
        public Base_InductionFurnaceController(
            IBase_InductionFurnaceService service,
            IBase_InductionFurnaceRepository repository,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _repository = repository;
            _httpContextAccessor = httpContextAccessor;
        }


        [Route("GetHeatTreeData"), HttpGet]
        public async Task<WebResponseContent> GetStagingAreas()
        {
            var heats = await _repository.FindAsync(c => c.Enable == 1);
            var data = heats.Select(c => new { c.Id, c.HeatName, c.HeatNo, ParentId = "-"});
            return new WebResponseContent() { Status = true, Data = data };
        }
    }
}
